package conf

import "net"

type ListenerConfig struct {
	Type     string
	Host     string
	Port     int32
	Protocol ProtocolConfig
}

type ProtocolConfig struct {
	Type     string
	Ssl      bool
	CertFile string
	KeyFile  string
}

type ContextKey struct {
	name string
}

func (k *ContextKey) String() string { return "net/http context value " + k.name }

var (
	TcpConnContextKey = &ContextKey{"tcp-conn"}
)

type TcpConnWrap struct {
	id string
	net.Conn
}

func NewTcpConnWrap(conn net.Conn, id string) *TcpConnWrap {
	return &TcpConnWrap{Conn: conn, id: id}
}

func (tc *TcpConnWrap) Native() *net.TCPConn {
	return tc.Conn.(*net.TCPConn)
}

func (tc *TcpConnWrap) Id() string {
	return tc.id
}
